package com.activiti.tool;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * 流程定义的删除
 * @author ldanniel
 */
public class DeleteProcessDefinition {
    private static final Logger logger = LoggerFactory.getLogger(DeleteProcessDefinition.class);

    public static void main(String[] args) {
        //创建
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        //获取RepositoryService
        RepositoryService repositoryService = processEngine.getRepositoryService();
        //删除流程定义
        //repositoryService.deleteDeployment("1");
        //第二种方式：级联删除(当前的流程并没有完成，特殊情况需要删除，则可以采用该方式)
        repositoryService.deleteDeployment("82501",true);
    }
}
